function compare(v1, v2) {
  var arr1 = v1.split(".");
  var arr2 = v2.split(".");

  arr1 = arr1.map((item) => item * 1);
  arr2 = arr2.map((item) => item * 1);
  //   console.log(arr1,arr2);

  for (var i = 0; i < arr1.length; i++) {
    if (arr1[i] > arr2[i]) {
      return 1;
    }

    if (arr1[i] < arr2[i]) {
      return -1;
    }
  }

  return 0;
}

console.log(compare("1.11.111.123", "1.2.3.4"));//1
console.log(compare("1.2.3.1423", "1.11.111.123"));//-1
console.log(compare("1.11.111.123", "1.11.111.123"));//0
